<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:apks="http://java.sun.com/jsf/composite/apks"
    xmlns:users="http://java.sun.com/jsf/composite/users"
    template="../usersTemplate.xhtml">
    <ui:define name="title">
        Profil
    </ui:define>
    <ui:define name="center">
        <h:form>
            <p:panel id="panel" header="Forma za izmenu profila:" style="width: 350px">
                <p:messages id="msgs" showDetail="true"/>
                <h:panelGrid columns="2" cellpadding="3">
                    <h:outputLabel for="firstname" value="*Ime:"/>
                    <p:inputText id="firstname" value="#{homeManagedBean.currentUser.firstname}" style="width: 210px;" required="true" requiredMessage="Polje sa imenom ne sme biti prazno!"><f:validateLength for="firstname" minimum="3" maximum="10" ></f:validateLength></p:inputText>

                    <h:outputLabel for="lastname" value="*Prezime:"/>
                    <p:inputText id="lastname" value="#{homeManagedBean.currentUser.lastname}" style="width: 210px;" required="true" requiredMessage="Polje sa prezimenom ne sme biti prazno!"/>

                    <h:outputLabel for="email" value="*Email:"/>
                    <p:inputText id="email" disabled="true" style="width: 210px;" value="#{homeManagedBean.currentUser.email}" />

                    <h:outputLabel for="username" value="*Korisnicko ime:"/>
                    <p:inputText id="username" disabled="true" style="width: 210px;" value="#{homeManagedBean.currentUser.username}"/>
                    <p:ajaxStatus>  
                        <f:facet name="start">  
                            <h:graphicImage style="width: 30px;height: 30px;" value="../images/spinner.gif" />  
                        </f:facet>  

                        <f:facet name="complete">  
                            <h:outputText value="" />  
                        </f:facet>  
                    </p:ajaxStatus>  
                    <p:commandButton action="#{profileManagedBean.save()}" value="Sacuvaj" update="panel"/>
                </h:panelGrid>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>